{extend name="base" /}
{block name="content"}

<blockquote class="layui-elem-quote">
    苏州公交实时查询信息（仅供参考）
</blockquote>

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>苏州公交实时查询信息（仅供参考）</legend>
</fieldset>
<div id="content">
    <form class="layui-form layui-form-pane" action="{:url('index/getList')}" id="form">
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 20%;">线路:</label>
            <div style="width: 50%;float: left;">
                <input type="text" name="linename" lay-verify="required" placeholder="线路名称，例：快线1, 55" autocomplete="off" class="layui-input" value="">
                <input type="hidden" name="__token__" id="token" value="{$Request.token}" />
            </div>
            <div style="float: left">
                <button class="layui-btn" lay-submit="" lay-filter="demo1" id="submit">搜索</button>
            </div>
        </div>
        <!--<div class="layui-form-item">
            <div class="layui-input-block">
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>-->
    </form>
    {if count($cookie_line)}
    <div style="margin-left: 5%;" id="cookieLine">
        {foreach name="$cookie_line" item="v"}
        <button class="layui-btn layui-btn-normal submit-button" data-value="{$v}">{$v}</button>
        {/foreach}
    </div>
    {/if}
</div>
<div id="msg">

</div>
{/block}
{block name="js"}

<!--<script src="http://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>-->
<script>
    var url = "{:url('index/getList')}";
    layui.use(['form','jquery'], function(){
        var $ = layui.jquery, form = layui.form(),layer = layui.layer;
        //监听提交
        form.on('submit(demo1)', function(data){
            /*layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            });*/
            //ajaxPost(data.field);
            return true;
        });

        $(function () {
            $('.submit-button').click(function () {
                var value = $(this).data('value');
                var token = $("#token").val();
                location.href = '{:url("index/getList")}?linename='+value+'&__token__=' + token;
                //ajaxPost({linename: value, __hash__: token});
            });
        });
    });
</script>
{/block}